create or replace function deleteText()
returns varchar(10) as
$$
begin
  return 'Delete';
end;
$$ language plpgsql immutable;
create or replace function errorCode()
returns integer as
$$
begin
  return 0;
end;
$$ language plpgsql immutable;
CREATE OR REPLACE FUNCTION extract_value(
   VARCHAR,
   XML
) RETURNS TEXT AS
$$
   SELECT CASE WHEN $1 ~ '@[[:alnum:]_]+$'
   THEN (xpath($1, $2))[1]
   WHEN $1 ~* '/text()$'
   THEN (xpath($1, $2))[1]
   WHEN $1 LIKE '%/'
   THEN (xpath($1 || 'text()', $2))[1]
   ELSE (xpath($1 || '/text()', $2))[1]
   END::text;

$$ LANGUAGE 'sql' IMMUTABLE;
create or replace function insertText()
returns varchar(10) as
$$
begin
  return 'Insert';
end;
$$ language plpgsql immutable;
create or replace function statusCall(integer, text) 
returns xml as
$$
  declare
  pCode alias for $1;
  pMessageText alias for $2;
  begin
    return xmlElement( name callStatus, 
		       xmlElement ( name statusCode, pCode),
		       xmlElement ( name statusMessage, pMessageText)
		      );
  end;
$$ language plpgsql immutable;
create or replace function successCode()
returns integer as
$$
begin
  return 1;
end;
$$ language plpgsql immutable;
create or replace function updateText()
returns varchar(10) as
$$
begin
  return 'Update';
end;
$$ language plpgsql immutable;